<template>
	<div class="userhb" v-if="show">
		<div class="userhb-left">
			<img src="../../../assets/img/Hb.png" >
			<label>新用户注册领取388元大红包</label>
		</div>
		<div class="userhb-right">
			<button type="button" @click="getshow()">立即领取<i class="iconfont icon-jiantouyou"></i></button>
		</div>
	</div>
</template>

<script>
	import Cookies from 'js-cookie';
	export default{
		name:'UserHB',
		data(){
			return{
				show:true
			}
		},
		mounted() {
			if(Cookies.get('phone')){
				this.show=false
			}else{
				this.show=true
			}
		},
		methods:{
			getshow(){
				if(!Cookies.get('phone')){
					this.$router.push({path:'/login',query:{url:'/'}})
				}else{
					this.$store.commit('setshow')
				}
			}
		},
		computed:{
			on_show(){
				return this.$store.state.on_show;
			}
		},
	}
</script>

<style scoped>
	.userhb{
		display: flex;
		justify-content: space-between;
		width: 100%;
		height: 1rem;
		background: rgba(0,0,0,0.8);
		position: fixed;
		bottom: 1.5rem;
		z-index: 100;
		border-radius: 0.2rem 0.2rem 0 0;
	}
	.userhb .userhb-left{
		display: flex;
		justify-content: flex-start;
		align-items: center;
		width: 65%;
		height: 100%;
		margin-left: 0.1rem;
	}
	.userhb .userhb-left img{
		width: 0.8rem;
		height: 70%;
	}
	.userhb .userhb-left label{
		color: white;
		font-size: 0.3rem;
		margin-left: 0.1rem;
	}
	.userhb .userhb-right{
		width: 35%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.userhb .userhb-right button{
		border: none;
		border-radius: 0.5rem;
		height: 80%;
		width: 80%;
		background-color: #ffc701;
		font-size: 0.28rem;
	}
	.userhb .userhb-right i{
		font-size: 0.2rem;
	}
</style>
